<template>
  <!-- 歌单封面 -->
  <div id="cover">
    <div
      class="item"
      @click="likeToDetail"
    >
      <div class="img">
        <!-- 遮罩 -->
        <div class="cover-mask">
          <div class="play-count iconfont icon-playfill">
            {{ coverInfo.count | filterCount }}
          </div>
          <div class="iconfont icon-playfill play-btn"></div>
        </div>
        <img v-lazy="coverInfo.picUrl" alt="cover" />
      </div>
      <div class="name">
        {{ coverInfo.name }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
    name:"SongListCover",
    // coverInfo三个参数：count、picUrl、name
    props:['coverInfo'],
    methods:{
      likeToDetail(){
        this.$router.push('/playlist/'+this.coverInfo.id)
      }
    }
};
</script>

<style lang='less' scope>
  #cover {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .item {
      padding: 1%;
      .img {
        width: 100%;
        position: relative;
        .date {
          width: 100%;
          height: 100%;
          position: absolute;
          display: flex;
          justify-content: center;
          align-items: center;
          cursor: pointer;
          span {
            margin-top: 10%;
            color: #fff;
            font-weight: bold;
            font-size: 22px;
          }
        }
        img {
          border-radius: 10px;
          width: 100%;
          height: 100%;
        }
        // 遮罩
        .cover-mask:hover {
          opacity: 1;
          transition: 500ms;
        }
        .cover-mask {
          opacity: 0;
          cursor: pointer;
          border-radius: 10px;
          position: absolute;
          width: 100%;
          height: 100%;
          background: rgba(0, 0, 0, 0.4);
          .play-count {
            position: absolute;
            right: 10px;
            top: 10px;
            color: #fff;
            font-size: 12px;
          }
          .play-btn {
            position: absolute;
            right: 10px;
            bottom: 10px;
            color: var(--themeColor1);
            background: #fff;
            border-radius: 50%;
            padding: 5px;
          }
        }
      }
      .name {
        text-align: center;
        margin-top: 5px;
        font-size: 14px;
        display: -webkit-box; /**对象作为伸缩盒子模型展示**/
        -webkit-box-orient: vertical; /**设置或检索伸缩盒子对象的子元素的排列方式**/
        -webkit-line-clamp: 2; /**显示的行数**/
        overflow: hidden; /**隐藏超出的内容**/
      }
    }
  }
</style>